package cn.com.chengmandian.bike.controller;

import cn.com.chengmandian.bike.dto.*;
import cn.com.chengmandian.bike.service.IEbPreOrderService;
import cn.com.chengmandian.core.web.pojo.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api(tags = "支付分相关接口")
@RestController
@RequestMapping("/member/pay")
public class EbMemberPayController {

    @Autowired
    private IEbPreOrderService preOrderService;

    @ApiOperation("微信支付分下单")
    @PostMapping("/wx/payscore/order")
    public AjaxResult wxPayScoreOrder(@RequestBody CreateWxPayScoreDto dto){
        return preOrderService.addOrder(dto);
    }

    @ApiOperation("商户预授权")
    @PostMapping("/preauthorization")
    public AjaxResult preAuthorization(){
        return preOrderService.preAuthorization();
    }

    @ApiOperation("预授权订单结果查询接口")
    @GetMapping("/preauthorization/result")
    public AjaxResult preAuthorization(String payNo) {
        return preOrderService.preAuthorizationSelect(payNo);
    }
}
